#pragma once
#include "../QbBondDefines.h"
#include <qbprotocol/include/SSQBModel.h>
#include <QWidget>
//#include <QStylePainter>
#include <vector>

class QGridLayout;
class QLabel;
class BondDealMatrixData;
class S_QBBOND_EXPORT BondDealMatrixImpl : public QWidget
{
public:
	BondDealMatrixImpl(QWidget* p);

	void setMatrixType(int type);
	int getMatrixType();

	void setMatrixData(BondDealMatrixData* pdata);
	void reloadData();
	void updateCell(std::map<int, int>& mapCell);

	void getScrollRange(QRect& r, int& range, int& page);//返回滚动条range
	void resize(int pos);
	void setDiffCDC(bool bDiffCDC);
	bool isDiffCDC() { return m_isDiffCDC; }
	void updateMatrix(int type);
	bool getTextShowType() const;
	int getChartShowType() const;
protected:
	virtual void leaveEvent(QEvent* event) override;

	void loadSetting();

private:
	BondDealMatrixData* m_pdata = nullptr;
	bool m_isDiffCDC = true;

	QGridLayout* m_layout;
	std::vector<int> m_vctColumn;
	std::vector<int> m_vctRow;
	int m_matrixType;
	int m_showColCount;
};